V = Variables
C = Claculation functions
The VC21LPFilter function implements a low-pass digital filter of the first order for values in the range from -999999 to +999999. It ' also provided the pre-charge filter option.
VC20LPFilter (Mode, Tsample, Tau, FilterIn, FilterOut)
Parameters:
| IN/OUT | VARIABLE TYPE | EXAMPLE NAME | DIM | |
|---|---|---|---|---|
| IN | CONST / GLOBAL | Mode | F | Mode of operation (0=pre-charge, 1=filter execution). |
| IN | CONST / SYSTEM | Tsample | W | Sample time filter (msec) [0÷32767]. |
| IN | CONST / SYSTEM | Tau | W | The filter time constant (ms) [0÷32767] |
| IN | GLOBAL | FilterIn | L | Value of the variable that you want to filter [-999999÷999999] |
| OUT | GLOBAL | FilterOut | L | Value of the filtered variable [-999999÷999999] |
La funzione VC21LPFilter implementa un filtro passa basso digitale del primo ordine la cui costante di tempo (Tau) è definita nei parametri passati alla funzione stesso. Supponendo di partire da un valore della variabile di ingresso pari a zero, l'uscita del filtro assume un valore pari al 63% dell'ingresso dopo il tempo Tau. Allo stesso modo la frequenza di taglio del filtro è
. L'argomento Mode se vale zero permette di precaricare il filtro ad un valore impostabile con l'argomento FilterIn.
;---------------------------------------------
; Project : REG_012
; Module Name : ReadTemp
; Author :
; Description : Read temperature & filter
;---------------------------------------------
MAIN:
CALL ReadTemp
swTsample = 100 ;100 ms tempo campionamento filtro
swTau = 5000 ;5 sec costante di tempo filtro
gfMode = 1 ; normale esecuzione
VC21LPFilter (gfMode,swTsample, swTau, gwFilterIn, gwFilterOut)
WAIT 1
JUMP MAIN